home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp48hor2
/
remote4.doc
< prev
next >
Wrap
Text File
|
1995-03-31
|
6KB
|
97 lines
(Comp.sys.hp48)
Item: 438 by stevev@greylady.uoregon.edu
Author: [Steve VanDevender]
Subj: REMOTE4: IR and IR2--IR remote-control sampling programs
Date: Tue Dec 31 1991
[Note: Also see REMOTE3 on this disk for another programmer's approach
to turning the HP 48 into a universal infrared remote control. -jkh-]
These programs embody a new way of performing infrared remote control
sampling on the HP-48. The previously distributed remote sampling
programs sampled IR input by continually reading the IR input and
immediately writing it out to memory. These programs use a different
approach--they continually sample the IR input while incrementing a
timing count, and only write information to memory when the IR state
changes or the counter overflows. This approach increases the
effective sampling rate under many circumstances and greatly reduces
the amount of memory needed to store samples. I have also paid
special attention to instruction timing to make sure that the timing
characteristics of the sampling and playback routines are as nearly
identical as possible; this has been a problem with some previous
attempts at remote sampling.
One of my motivations for writing these programs was that the other IR
samplers I tried wouldn't work at all with my VCR. Both of these work
with my VCR, although I have obtained mixed results using these
programs with other kinds of remotes. I am hoping that these programs
will be more effective than previous attempts, and that the techniques
I have used here can be improved upon by others.
There are two separate IR sampling systems included here. The first,
in the IR subdirectory, are the first programs I developed that
worked. They store 3-nibble sample units--1 nibble for the current IR
input state, and 2 nibbles for a repeat count. The inner loop of the
sampling and playback routines runs at about 25 microseconds per loop
iteration, and take about 40 microseconds to write out the sample data
and re-enter the inner loop. These routines will make samples of
about 90 bytes that work with my VCR. The second, in IR2, are
2-nibble samples containing a 1-nibble repeat count. The inner loop
of these routines runs at about 23 microseconds per iteration, but
sample string are a little over twice as long, at 224 bytes for
samples that work with my VCR. Interestingly enough, though, Lutz
Vieweg's RFP program will pack samples created by either set of
routines to about the same length of 60 bytes. [Note: See RF on
Goodies Disk #5 in the PROGRAMR directory. -jkh-]
The directory IR contains the 3-nibble sampling routines, and the
directory IR2 contains the 2-nibble sampling routines. IR contains
the user RPL programs SAMPLE and PLAYBACK and the machine code objects
IRSAMP and IRPLAY. IR2 contains SAMPLE2, PLAYBACK2, IRSAMP2, and
IRPLAY2.
The program SAMPLE (SAMPLE2) will take either a real number in level
1, which is used to generate a string of that length to receive the
sample, or a string which will be overwritten with sample data. It
calls the machine-language program IRSAMP (IRSAMP2) which performs the
sampling. IRSAMP checks for a string object in level 1, which must
have SIZE > 1, and aborts if it doesn't find one. It then waits up to
15 seconds for IR input, (that is, for you to place your remote
control next to the calculator and press the button for the remote
function you want to sample) and aborts if none is received in that
time. Otherwise it begins sampling and exits when the end of the
string in level 1 is reached. I have found that holding an IR remote
too close to the calculator during sampling will often result in
ineffective samples; I get best results with the remote about 5-10 cm
from the IR input port.
The program PLAYBACK (PLAYBACK2) will take a string in level 1 and
feed it to IRPLAY (IRPLAY2), then drop the string. You can feed
strings directly to IRPLAY if you wish, but they will be left on the
stack (although this is a useful way to test samples without having to
recover them with LASTARG). You should only feed strings created with
IRSAMP to PLAYBACK or IRPLAY. It is possible to create strings which
leave the HP-48 IR LED on for long periods of time, which drains the
batteries and may cause hardware damage. In any case, IRPLAY will
turn the IR LED off before exiting.
Two of my friends who have tested these programs have reported that
they have experienced crashes while using them, although one report
did not appear to involve memory corruption or any other damage.
Therefore, I do not guarantee these programs to be bug-free--they may
cause crashes, memory corruption, or even hardware damage if used
improperly, although I can also say that I have had no problems for
over a week since I debugged the routines in the IR directory.
Neither are they guaranteed to work with any IR remote control,
although I suspect they will have greater success than previous remote
sampling programs.
I would like to thank Dave Marsh for his original IR sampling
programs, which I have copied small parts of and which were my main
source of technical information in writing these programs, and Jan
Brittenson for his excellent STAR assembler and MLDL debugger which
made writing and debugging these programs easy.
--
Steve VanDevender stevev@greylady.uoregon.edu